#pragma once
#include "CWebBrowser2.h"
#include "SimpleImageButton.h"
#include <string>
// CGameDlg dialog

class CGameDlg : public CDialogEx
	,ISimpleImageButtonEventListener
{
	DECLARE_DYNAMIC(CGameDlg)

public:
	CGameDlg(CDialogEx* pParent = NULL);   // standard constructor
	virtual ~CGameDlg();

// Dialog Data
	enum { IDD = IDD_DIALOG_GAME ,
		IDC_WEB_BROWSER,
		IDC_BTN_CLOSE,
		IDC_BTN_MINI,
		IDC_BTN_MAX};

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	void InitiliazeBackground(void);
	void InitializeUI();
	void DrawBuffer();
	void UpdateBtnPos(int cx, int cy);
protected:
	Gdiplus::Bitmap* m_pResourceImage;	
	Gdiplus::Bitmap* m_pGapImage;	
	Gdiplus::CachedBitmap* m_pCacheImage;	
	CWebBrowser2 m_ctrWeb;
	CSimpleImageButton m_btnClose;
	CSimpleImageButton m_btnMini;
	CSimpleImageButton m_btnMax;
	std::wstring m_sTitle;		 
	CDialogEx* m_rootDlg;
	DECLARE_MESSAGE_MAP()
public:
	DECLARE_EVENTSINK_MAP()
public:
	virtual BOOL OnInitDialog();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnSize(UINT nType, int cx, int cy);

	void OnClick(CSimpleImageButton* pEventSource);
	void OnDClick(CSimpleImageButton* pEventSource);
	void OpenUrl(std::wstring url);
	void OnTitleChange(LPCTSTR Text);	
public:
	
	virtual void OnOK();
	afx_msg LRESULT OnNcHitTest(CPoint point);	
	virtual BOOL PreTranslateMessage(MSG* pMsg);
};
